<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QFileSystemWatcher Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFileSystemWatcher Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QFileSystemWatcher class provides an interface for
monitoring files and directories for modifications. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qfilesystemwatcher.html#QFileSystemWatcher">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qfilesystemwatcher.html#QFileSystemWatcher-2">__init__</a></b> (<i>self</i>, QStringList&#160;<i>paths</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qfilesystemwatcher.html#addPath">addPath</a></b> (<i>self</i>, QString&#160;<i>file</i>)</li><li><div class="fn" /><b><a href="qfilesystemwatcher.html#addPaths">addPaths</a></b> (<i>self</i>, QStringList&#160;<i>files</i>)</li><li><div class="fn" />QStringList <b><a href="qfilesystemwatcher.html#directories">directories</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qfilesystemwatcher.html#files">files</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qfilesystemwatcher.html#removePath">removePath</a></b> (<i>self</i>, QString&#160;<i>file</i>)</li><li><div class="fn" /><b><a href="qfilesystemwatcher.html#removePaths">removePaths</a></b> (<i>self</i>, QStringList&#160;<i>files</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qfilesystemwatcher.html#directoryChanged">directoryChanged</a></b> (const QString&amp;)</li><li><div class="fn" />void <b><a href="qfilesystemwatcher.html#fileChanged">fileChanged</a></b> (const QString&amp;)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFileSystemWatcher class provides an interface for
monitoring files and directories for modifications.</p>
<p>QFileSystemWatcher monitors the file system for changes to files
and directories by watching a list of specified paths.</p>
<p>Call <a href="qfilesystemwatcher.html#addPath">addPath</a>() to
watch a particular file or directory. Multiple paths can be added
using the <a href="qfilesystemwatcher.html#addPaths">addPaths</a>()
function. Existing paths can be removed by using the <a href="qfilesystemwatcher.html#removePath">removePath</a>() and <a href="qfilesystemwatcher.html#removePaths">removePaths</a>()
functions.</p>
<p>QFileSystemWatcher examines each path added to it. Files that
have been added to the QFileSystemWatcher can be accessed using the
<a href="qfilesystemwatcher.html#files">files</a>() function, and
directories using the <a href="qfilesystemwatcher.html#directories">directories</a>()
function.</p>
<p>The <a href="qfilesystemwatcher.html#fileChanged">fileChanged</a>() signal is
emitted when a file has been modified, renamed or removed from
disk. Similarly, the <a href="qfilesystemwatcher.html#directoryChanged">directoryChanged</a>()
signal is emitted when a directory or its contents is modified or
removed. Note that QFileSystemWatcher stops monitoring files once
they have been renamed or removed from disk, and directories once
they have been removed from disk.</p>
<p><b>Note:</b> On systems running a Linux kernel without inotify
support, file systems that contain watched paths cannot be
unmounted.</p>
<p><b>Note:</b> Windows CE does not support directory monitoring by
default as this depends on the file system driver installed.</p>
<p><b>Note:</b> The act of monitoring files and directories for
modifications consumes system resources. This implies there is a
limit to the number of files and directories your process can
monitor simultaneously. On Mac OS X 10.4 and all BSD variants, for
example, an open file descriptor is required for each monitored
file. Some system limits the number of open file descriptors to 256
by default. This means that <a href="qfilesystemwatcher.html#addPath">addPath</a>() and <a href="qfilesystemwatcher.html#addPaths">addPaths</a>() will fail if your
process tries to add more than 256 files or directories to the file
system monitor. Also note that your process may have other file
descriptors open in addition to the ones for files being monitored,
and these other open descriptors also count in the total. Mac OS X
10.5 and up use a different backend and do not suffer from this
issue.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFileSystemWatcher" />QFileSystemWatcher.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new file system watcher object with the given
<i>parent</i>.</p>


<h3 class="fn"><a name="QFileSystemWatcher-2" />QFileSystemWatcher.__init__ (<i>self</i>, QStringList&#160;<i>paths</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new file system watcher object with the given
<i>parent</i> which monitors the specified <i>paths</i> list.</p>


<h3 class="fn"><a name="addPath" />QFileSystemWatcher.addPath (<i>self</i>, QString&#160;<i>file</i>)</h3><p>Adds <i>path</i> to the file system watcher if <i>path</i>
exists. The path is not added if it does not exist, or if it is
already being monitored by the file system watcher.</p>
<p>If <i>path</i> specifies a directory, the <a href="qfilesystemwatcher.html#directoryChanged">directoryChanged</a>()
signal will be emitted when <i>path</i> is modified or removed from
disk; otherwise the <a href="qfilesystemwatcher.html#fileChanged">fileChanged</a>() signal is
emitted when <i>path</i> is modified, renamed or removed.</p>
<p><b>Note:</b> There is a system dependent limit to the number of
files and directories that can be monitored simultaneously. If this
limit has been reached, <i>path</i> will not be added to the file
system watcher, and a warning message will be printed to
<i>stderr</i>.</p>
<p><b>See also</b> <a href="qfilesystemwatcher.html#addPaths">addPaths</a>() and <a href="qfilesystemwatcher.html#removePath">removePath</a>().</p>


<h3 class="fn"><a name="addPaths" />QFileSystemWatcher.addPaths (<i>self</i>, QStringList&#160;<i>files</i>)</h3><p>Adds each path in <i>paths</i> to the file system watcher. Paths
are not added if they not exist, or if they are already being
monitored by the file system watcher.</p>
<p>If a path specifies a directory, the <a href="qfilesystemwatcher.html#directoryChanged">directoryChanged</a>()
signal will be emitted when the path is modified or removed from
disk; otherwise the <a href="qfilesystemwatcher.html#fileChanged">fileChanged</a>() signal is
emitted when the path is modified, renamed, or removed.</p>
<p><b>Note:</b> There is a system dependent limit to the number of
files and directories that can be monitored simultaneously. If this
limit has been reached, the excess <i>paths</i> will not be added
to the file system watcher, and a warning message will be printed
to <i>stderr</i> for each path that could not be added.</p>
<p><b>See also</b> <a href="qfilesystemwatcher.html#addPath">addPath</a>() and <a href="qfilesystemwatcher.html#removePaths">removePaths</a>().</p>


<h3 class="fn"><a name="directories" />QStringList QFileSystemWatcher.directories (<i>self</i>)</h3><p>Returns a list of paths to directories that are being
watched.</p>
<p><b>See also</b> <a href="qfilesystemwatcher.html#files">files</a>().</p>


<h3 class="fn"><a name="files" />QStringList QFileSystemWatcher.files (<i>self</i>)</h3><p>Returns a list of paths to files that are being watched.</p>
<p><b>See also</b> <a href="qfilesystemwatcher.html#directories">directories</a>().</p>


<h3 class="fn"><a name="removePath" />QFileSystemWatcher.removePath (<i>self</i>, QString&#160;<i>file</i>)</h3><p>Removes the specified <i>path</i> from the file system
watcher.</p>
<p><b>See also</b> <a href="qfilesystemwatcher.html#removePaths">removePaths</a>() and
<a href="qfilesystemwatcher.html#addPath">addPath</a>().</p>


<h3 class="fn"><a name="removePaths" />QFileSystemWatcher.removePaths (<i>self</i>, QStringList&#160;<i>files</i>)</h3><p>Removes the specified <i>paths</i> from the file system
watcher.</p>
<p><b>See also</b> <a href="qfilesystemwatcher.html#removePath">removePath</a>() and <a href="qfilesystemwatcher.html#addPaths">addPaths</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="directoryChanged" />void directoryChanged (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the directory at a specified
<i>path</i>, is modified (e.g., when a file is added, modified or
deleted) or removed from disk. Note that if there are several
changes during a short period of time, some of the changes might
not emit this signal. However, the last change in the sequence of
changes will always generate this signal.</p>
<p><b>See also</b> <a href="qfilesystemwatcher.html#fileChanged">fileChanged</a>().</p>


<h3 class="fn"><a name="fileChanged" />void fileChanged (const QString&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the file at the specified
<i>path</i> is modified, renamed or removed from disk.</p>
<p><b>See also</b> <a href="qfilesystemwatcher.html#directoryChanged">directoryChanged</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>